package com.fp.m7.client.view;

import com.fp.m7.client.presenter.HeaderSecuredPresenter;
import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.HasClickHandlers;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.Anchor;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.Widget;

/**
 * Secured header view. Has: new comment, profile, timeline, settings, logout anchors.
 * 
 * @author 7
 */
public class HeaderSecuredView extends Composite implements HeaderSecuredPresenter.Display {

    private static HeaderSecuredViewUiBinder uiBinder = GWT.create(HeaderSecuredViewUiBinder.class);

    interface HeaderSecuredViewUiBinder extends UiBinder<Widget, HeaderSecuredView> {
    }

    @UiField
    Anchor aNewComment;
    @UiField
    Anchor aProfile;
    @UiField
    Anchor aTimeline;
    @UiField
    Anchor aSettings;
    @UiField
    Anchor aLogout;
    @UiField
    Label lblAuthUser;

    public HeaderSecuredView() {
        initWidget(uiBinder.createAndBindUi(this));
    }

    @Override
    public HasClickHandlers getNewCommentButton() {
        return aNewComment;
    }

    @Override
    public HasClickHandlers getProfileButton() {
        return aProfile;
    }

    @Override
    public HasClickHandlers getTimelineButton() {
        return aTimeline;
    }

    @Override
    public HasClickHandlers getSettingsButton() {
        return aSettings;
    }

    @Override
    public HasClickHandlers getLogoutButton() {
        return aLogout;
    }

    @Override
    public void setContent(String nickname) {
        lblAuthUser.setText(nickname);
    }

}
